cmake_minimum_required(VERSION 3.15)
project(tcp)
file(GLOB client ${CMAKE_SOURCE_DIR}/client.c socket.c)
file(GLOB server ${CMAKE_SOURCE_DIR}/server.c socket.c clientList.c)
# 查找线程库
find_package(Threads REQUIRED)
set(CMAKE_CXX_STANDARD 11)
# 设置可执行文件存储路径
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR})
add_executable(tcpclient ${client})
add_executable(tcpserver ${server})
# 连接动态库
target_link_libraries(tcpserver PRIVATE Threads::Threads)
target_link_libraries(tcpclient PRIVATE Threads::Threads)